Here's the script that creates a glossary automatically.